home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: dequeueFrom.c,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:38 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
- #include "sysdefs.h"
- #include "queue_consist.h"
- #include "ess.h"
- #include "checking.h"
- #include "list.h"
- #include "error.h"
- #include "tid.h"
- #include "pool.h"
- #include "io.h"
- #include "bitvec.h"
- #include "lock.h"
- #include "msgdefs.h"
- #include "disk.h"
- #include "thread.h"
- #include "semaphore.h"
- #include "latch.h"
- #include "bf.h"
- #include "link.h"
- #include "volume.h"
- #include "trace.h"
- #include "msgvector.h"
- #include "disk_funcs.h"
- #include "disk_globals.h"
- #include "io_globals.h"
- #include "msg_globals.h"
- #include "thread_globals.h"
- #include "sharedmem_globals.h"
- #include "queue_globals.h"
-
- /*
- * This function assumes we have the mutex.
- * It returns 1 if we found something on the queue
- * and 0 if the queue was empty.
- */
- int
- dequeueFrom(
- QUEUEPAIR *q,
- ShmOffset *result
- )
- {
- ShmOffset *elements = &(q->elements);
- TRPRINT(TR_THREAD, TR_LEVEL_1,
- ("(Thread %d state %d) from.front %d from.back %d",
- Active->id, Active->state, q->fromDisk.front, q->fromDisk.back));
-
- if(fromDiskEmpty(q))
- return 0;
-
- *result = elements[q->fromDisk.front++];
- if(q->fromDisk.front >= QUEUE_SIZE)
- q->fromDisk.front = 0;
- return 1;
- } /* dequeueFrom */
-